package com.abel.service_provider;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Manager {

    private static Map<String, Driver> map = new ConcurrentHashMap<String, Driver>();

    /**
     * provider registration API
     * @param name
     * @param driver
     * @return
     */
    public static Driver register(String name, Driver driver){
        return map.put(name, driver);
    }

    /**
     * service access API
     * which clients use to obtain instances of the service.
     * The service access API may allow clients to specify criteria for choosing an implementation.
     * In the absence of such criteria, the API returns an instance of a default implementation, or allows
     * the client to cycle through all available implementations.
     * @return
     */
    public static Map<String, Driver> getRegister(){
        return map;
    }

}
